<?php

declare(strict_types=1);

namespace app\admin\validate;

use think\Validate;

class MinerFirmwareversion extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require|integer',
        'pid' => 'require',
        'firmware_fileid' => 'require|integer',
        'version_id' => 'require|string',
        'release_date' => 'require|string',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => 'id不能为空',
        'id.integer' => 'id必须是整数',
        'pid.require' => 'pid不能为空',
        'firmware_fileid.require' => 'firmware_fileid不能为空',
        'firmware_fileid.integer' => 'firmware_fileid必须是整数',
        'version_id.require' => 'version_id不能为空',
        'version_id.string' => 'version_id必须是字符串',
    ];

    protected $scene = [
        'create' => ['pid', 'firmware_fileid', 'version_id', 'release_date'],
        'update' => ['id', 'pid', 'firmware_fileid', 'version_id', 'release_date'],
    ];
}
